

const pluginFeatureDAO = require('../../core/rdsService/pluginFeatureDAO');

const { localPluginWarper } = require('../warper/pluginWarper')

exports.getLocalPluginByKeywordInitials = function (keyword) {
    // 通过首写字母
    return new Promise(function (resolve, reject) {


        pluginFeatureDAO.getPluginFeatureByCondition(null, null, null, "initials", "keyword", null, "search", keyword, (features) => {
            if (features.length == 0) {
                return resolve([])
            } else {
                return resolve(localPluginWarper(features))
            }
        })
    })
}



exports.getLocalPluginByKeywordRegular = function (keyword) {
    // 通过正则
    return new Promise(function (resolve, reject) {
        pluginFeatureDAO.getPluginFeatureByCondition(null, null, null, "regular", "keyword", null, "search", keyword, (features) => {
            if (features.length == 0) {
                return resolve([])
            } else {
                return resolve(localPluginWarper(features))
            }
        })
    })
}